package com.xiaoshuidi.cloud.module.iot.enums;

import cn.hutool.core.util.StrUtil;

/**
 * 当跨业务系统时，该标签需要暴露给上游或者下游系统；
 * iot约定，所有的门锁服务发出的消息tag = iot_door_lock；
 * MsgTagEnum
 * @author wael
 * @since 20230413
 */
public enum MsgTagEnum {
    iot_door_lock("iot_door_lock","门锁密码清理及发送新密码");
    private String code;
    private String msg;

    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    MsgTagEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static MsgTagEnum getInstance(String code){
        if(StrUtil.isEmpty(code)){
            return null;
        }
        for (MsgTagEnum instance:values()) {
            if(instance.getCode().equals(code)){
                return instance;
            }
        }
        return null;
    }
}
